import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '创建日期',
    align: 'center',
    dataIndex: 'createTime'
   },
   {
    title: '类别编码',
    align: 'center',
    dataIndex: 'typeCode'
   },
   {
    title: '类别名称',
    align: 'left',
    dataIndex: 'typeName'
   },
   {
    title: '级别',
    align: 'center',
    dataIndex: 'typeLevel'
   },
   {
    title: '备注',
    align: 'center',
    dataIndex: 'remark'
   },
   {
    title: '状态',
    align: 'center',
    dataIndex: 'typeStatus_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "类别编码",
      field: "typeCode",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "类别名称",
      field: "typeName",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
	{
      label: "级别",
      field: "typeLevel",
      component: 'Input',
      //colProps: {span: 6},
     },
	{
      label: "状态",
      field: "typeStatus",
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"valid_status"
      },
      //colProps: {span: 6},
     },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '父级节点',
    field: 'pid',
    component: 'JTreeSelect',
    componentProps: {
      dict: "tbl_algorithm_type,type_name,id",
      pidField: "pid",
      pidValue: "0",
      hasChildField: "has_child",
    },
  },
  {
    label: '类别编码',
    field: 'typeCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入类别编码!'},
          ];
     },
  },
  {
    label: '类别名称',
    field: 'typeName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入类别名称!'},
          ];
     },
  },
  {
    label: '级别',
    field: 'typeLevel',
    component: 'Input',
    dynamicDisabled:true
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'typeStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"valid_status"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  createTime: {title: '创建日期',order: 0,view: 'datetime', type: 'string',},
  typeCode: {title: '类别编码',order: 2,view: 'text', type: 'string',},
  typeName: {title: '类别名称',order: 3,view: 'text', type: 'string',},
  typeLevel: {title: '级别',order: 4,view: 'text', type: 'string',},
  remark: {title: '备注',order: 5,view: 'text', type: 'string',},
  typeStatus: {title: '状态',order: 6,view: 'list', type: 'string',dictCode: 'valid_status',},
};


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
